// 导入自己封装的axios实例对象
import request from '@/utiles/request'

export const getArticleList = params => {
    return request({
        url: '/v1_0/articles',
        params
    })
}

// 获取文章详情
export const getArticleDetail = id => {
    return request({
        url: '/v1_0/articles/' + id,
    })
}

// 文章收藏
export const addArticleCollect = data => {
    return request({
        url: '/v1_0/article/collections',
        method: 'POST',
        data
    })
}

// 取消文章收藏
export const deleteArticleCollect = target => {
    return request({
        url: '/v1_0/article/collections/' + target,
        method: 'DELETE',
    })
}

// 文章点赞
export const addArticleZan = data => {
    return request({
        url: '/v1_0/article/likings',
        method: 'POST',
        data
    })
}

// 取消文章点赞
export const deleteArticleZan = target => {
    return request({
        url: '/v1_0/article/likings/' + target,
        method: 'DELETE',
    })
}